package com.example.building_material_mannager.controller;

import com.example.building_material_mannager.entity.Supplier;
import com.example.building_material_mannager.service.SupplierService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;
@Controller
@RequestMapping("supplier")
public class SupplierController {

    @Resource
    SupplierService supplierService;
    @RequestMapping("show")
    @ResponseBody
    public List<Supplier> showSupplier(Supplier supplier){


        List<Supplier> suppliers = supplierService.showSupplier(supplier);
        return suppliers;

    }
    //增加
    public void addSupplier(Supplier supplier){

        boolean re = supplierService.addSupplier(supplier);
        System.out.println(re);
    }

    //刪除
    public void delSupplier(Integer sid){

        boolean re = supplierService.delSupplier(sid);
        System.out.println(re);
    }
    //更新
    public void upSupplier(Supplier supplier){

        boolean re = supplierService.upSupplier(supplier);
        System.out.println(re);
    }
}
